﻿using System;
using System.Collections.Generic;
using System.Linq;
using Fuse8.DomainFramework.Common;

namespace Fuse8.DomainFramework.DataAccess.SqlDatabase
{
	/// <summary>
	/// Base implementation of sql tables and columns configurator
	/// </summary>
	public class DefaultEntityMappingConfigurator : IEntityMappingConfigurator
	{
		/// <summary>
		/// Returns table name by entity type
		/// </summary>
		/// <param name="type">Entity type</param>
		/// <returns></returns>
		public virtual string GetEntityTableName(Type type)
		{
			return Pluralizer.Pluralize(type.Name);
		}

		/// <summary>
		/// Returns entity column name by entity type and sql column name
		/// </summary>
		/// <param name="type">Entity type</param>
		/// <param name="column">Sql column name</param>
		/// <returns></returns>
		public virtual string GetEntityColumnAlias(Type type, string column)
		{
			return null;
		}

		/// <summary>
		/// Returns collection of the ignored columns by entity type
		/// </summary>
		/// <param name="type">Entity type</param>
		/// <returns></returns>
		public virtual IEnumerable<string> GetIgnoredColumns(Type type)
		{
			return Enumerable.Empty<string>();
		}

	    /// <summary>
	    /// Gest database related name for property
	    /// </summary>
	    /// <param name="type">Type where specified prorpety situated</param>
	    /// <param name="property">Property name</param>
	    /// <returns></returns>
	    public virtual string GetRelatedPropertyColumnName(Type type, string property)
	    {
	        return null;
	    }
	}
}